﻿using FriendStar.Code;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using FriendStar.Application.VBaseData;
using FriendStar.Domain.Entity.VBaseData;

namespace FriendStar.Web.Areas.VBaseData.Controllers
{
    public class V_CPK_44_MX_StoCPKListAcco_Mid_MXController : ControllerBase
    {
        //
        // GET: /VBaseData/V_CPK_44_MX_StoCPKListAcco_Mid_MX/

        private V_CPK_44_MX_StoCPKListAcco_Mid_MXApp dutyApp = new V_CPK_44_MX_StoCPKListAcco_Mid_MXApp();

        [HttpGet]
        [HandlerAjaxOnly]
      
        public ActionResult GetJson(string keyword)
        {
            var data = dutyApp.GetList2();
            return Content(data.ToJson());
        }
        public ActionResult GetGridJson(Pagination pagination, string unit, string date,bool isCurrent,int type)
        { 
            var data = new
            {
                rows = dutyApp.GetList(pagination, unit, date, Configs.GetValue("UseUnit"),isCurrent,type),
                total = pagination.total,
                page = pagination.page,
                records = pagination.records
            };

            return Content(data.ToJson());
        }

        public ActionResult GetGridJsonOrg(Pagination pagination, string faccountDate, string fproductionNo, string fproductionName, string fproCompanyNO, string FProductionTypeNO)
        {
            var data = new
            {
                rows = dutyApp.GetListOrg(pagination, faccountDate, fproductionNo, fproductionName, fproCompanyNO, FProductionTypeNO),
                total = pagination.total,
                page = pagination.page,
                records = pagination.records
            };
            return Content(data.ToJson());
        }

        public ActionResult GetGridJsonOrgCate(Pagination pagination, string faccountDate, string fproductionTypeNo,bool isCurrent)
        {
            
              var data = new
            {
                rows = dutyApp.GetGridJsonOrgCate(pagination, faccountDate, fproductionTypeNo,isCurrent),
                total = pagination.total,
                page = pagination.page,
                records = pagination.records
            };
            return Content(data.ToJson());
        }

        public ActionResult GetGridJsonOut(Pagination pagination, string unit, string date, bool isCurrent, int type)
        {
            var data = new
            {
                rows = dutyApp.GetListOut(pagination, unit, date, Configs.GetValue("UseUnit"), isCurrent, type),
                total = pagination.total,
                page = pagination.page,
                records = pagination.records
            };

            return Content(data.ToJson());
        }


    }
}
